snippet newm "包含main 主体和脚本入口" b
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    ${1:pass}


if __name__ == '__main__':
    main()
endsnippet

snippet newa "包含 main 主体和脚本入口以及参数解析方法" b
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from argparse import ArgumentParser


def parse_args():
    def add_bool_args(p, name, help):
        p.add_argument('--' + name, dest=name, help=help, action='store_true')
        p.set_defaults(**{name: False})

    parser = ArgumentParser(description='${1:该脚本的功能说明}')
    parser.add_argument('-f', '--file', help='输入文件路径', required=True)

    return parser.parse_args()

def main():
    args = parse_args()


if __name__ == '__main__':
    main()
endsnippet

snippet rlf "生成一个按行读取文件的函数" b
def readline(f):
    with open(f) as fp:
        for l in fp:
		    j = l.strip()
			if j:
			    yield j
${0}
endsnippet
